#!/bin/bash

set -e

# product version
PROD_VERSION="1.0.0"
# CPU architecture
ARCH="amd64"

# clean old initrd_prod.img
if [ -f ${TMP_DIR}/initrd_prod.img-${PROD_VERSION}-${ARCH} ]; then
    rm -rf ${TMP_DIR}/initrd_prod.img-${PROD_VERSION}-${ARCH}
fi

# pkg initrd_prod.img
cd ${WORK_DIR}/initramfs/${ARCH}
find . | cpio -H newc -o | zstd > ${TMP_DIR}/initrd_prod.img-${PROD_VERSION}-${ARCH}
echo "initrd_prod.img is created at ${TMP_DIR}/initrd_prod.img-${PROD_VERSION}-${ARCH}"
